<?php
  class controllerBase
  {
      public $sController = '';
      public $sAction = '';
      public $iId = '';
      public $sAlias = '';
      public $aParams = array();
      public $database = null;
      public $url = null;
      public $sLink = '';
      
      public function __construct($aParam = array())
      {
          if(!empty($aParam['controller']))
          {
              $this->sController = $aParam['controller'];
              $this->aParams['sController'] = $aParam['controller'];
          }
          
          if(!empty($aParam['action']))
          {
              $this->sAction = $aParam['action'];
              $this->aParams['sAction'] = $aParam['action'];
          }
          
          if(!empty($aParam['id']))
          {
              $this->iId = $aParam['id'];
              $this->aParams['sId'] = $aParam['id'];
          }
          
          if(!empty($aParam['alias']))
          {
              $this->sAlias = $aParam['alias'];
              $this->aParams['alias'] = $aParam['alias'];
          }
          $this->sLink = trim($this->sController.'/'.$this->sAction.'/'.$this->iId, '/');
          $this->database = new database();
          $this->url = new URL();
      }
      
      public function process()
      {
          
      }
      
      public function get($sParam)
      {
          if(isset($this->aParams[$sParam]))
          {
              return $this->aParams[$sParam];
          }
          return false;
      }
      
      public function set($aParams = array())
      {
          foreach($aParams as $key => $value)
          {
              $this->aParams[$key] = $value;
          }
      }
      
      public function setTitle($value)
      {
          core::setParam('site_title', $value);
      }
  }
?>
